<style type="text/css">
table {
  border-collapse: collapse;
}

table td {
  border: 1px solid silver;
}
</style>
<form action="/backend_dev.php/matrix/save" method="post">
  <input type="hidden" name="left" value="<?php echo $group_left ?>" />
  <input type="hidden" name="top" value="<?php echo $group_top ?>" />
<table>
  <?php for($j = 0; $j <= count($left); $j++): ?>
    <tr>
      <?php if($j): ?>
        <td style="padding-left: 10px;"><?php echo $left[$j-1]['title'] ?></td>
      <?php else: ?>
        <td></td>
      <?php endif ?>

      <?php foreach($top as $param): ?>
        <?php if(!$j): ?>
          <td align="center"><?php echo $param['title'] ?></td>
        <?php else: ?>
          <td align="center"><input type="hidden" name="matrix[<?php echo $left[$j-1]['id'] ?>][<?php echo $param['id'] ?>]" value="0" /><input type="checkbox" name="matrix[<?php echo $left[$j-1]['id'] ?>][<?php echo $param['id'] ?>]" value="1" /></td>
        <?php endif ?>
      <?php endforeach ?>
    </tr>
  <?php endfor ?>
  <tr>
    <td align="right" colspan="<?php echo count($top) + 1 ?>" style="padding: 10px"><input type="submit" value="Save" /></form></td>
  </tr>
</table>